import fetch from 'utils/request'
// import axios from 'axios'
export interface LoginType {
  username: string
  password: string
}

interface ResponseType {
  code: number
  msg: string
  data: {
    token: string
  }
}

export const fetchLogin = ({ username, password }: LoginType) => {
  return fetch.post('/api/login', { username, password })
  // return new Promise<ResponseType>((resolve, reject) => {
  //   setTimeout(() => {
  //     resolve({
  //       code: 0,
  //       msg: 'success',
  //       data: {
  //         token: `${username}_123`,
  //       },
  //     })
  //   }, 3000)
  // })
}
